package com.lr.service.impl;

import com.lr.domain.entity.Departments;
import com.lr.infra.mapper.DepartmentMapper;
import com.lr.service.DepartmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Resource
    private DepartmentMapper departmentMapper;


    @Override
    public List<Departments> findDep() {
        List<Departments> department = departmentMapper.findDep();
        System.out.println("查询成功！");
        return department;
    }

    @Override
    public void createDepartment(Departments department) {
        departmentMapper.createDepartment(department);
        System.out.println("创建成功！");
    }

    @Override
    public void deleteDepartment(Integer id) {
        departmentMapper.deleteDepartment(id);
        System.out.println("删除成功！");
    }

    @Override
    public void updateDepartment(Departments department) {
        departmentMapper.updateDepartment(department);
        System.out.println("更新成功！");
    }

    @Override
    public List<Departments> oneToNum() {
        List<Departments> departments = departmentMapper.oneToNum();
        System.out.println("组合查询成功！");
        return departments;
    }
}
